package com.qilu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qilu.domain.dto.UserListDTO;
import com.qilu.domain.entity.SysUserEntity;
import com.qilu.domain.vo.SysUserVo;
import com.qilu.mapper.SysUserMapper;
import com.qilu.service.SysUserService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author
 * @since 2023-05-07
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity> implements SysUserService {

    @Override
    public SysUserEntity getSysUserByUsername(String username) {
        LambdaQueryWrapper<SysUserEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysUserEntity::getUsername, username);
        return getOne(wrapper);
    }

    @Override
    public List<SysUserVo> getSysUser(UserListDTO param) {
        return baseMapper.getSysUser(param);
    }

    @Override
    public SysUserEntity getSysUserById(Integer id) {
        return getOne(new LambdaQueryWrapper<SysUserEntity>()
                .eq(SysUserEntity::getId, id));
    }


}
